#ifndef SEGMENTATION_H
#define SEGMENTATION_H
#include <QImage>

//Segmentation method - REGION GROWING
class Segmentation{
public:
    Segmentation();
    void    Clicked(int,int);
    void    SetData(QImage*);
    QImage  *GetData() const;
    QImage  *GetSegments() const;
    void    AllSegments(bool);
    void    FindSegments();
    void    SetTolerance(int);
    static const uint red = 16711680;
    static const uint white = 16777215;
    static const uint black =0;
    void    DisplaySegment(int, int);
private:
    int     clickedX;
    int     clickedY;
    int     tolerance;
    QImage  *m_Data;
    QImage  *m_SegData;
    QImage  *m_Segments;
    bool     allSegments;//false - calclulate only region for clicked pixel, true - all similar regions
    bool     InRegionGrey(int,int,uint);
    void     CheckPoint(int,int,uint,uint);
    void     CheckPointRGB(int,int,uint,uint,uint,uint);

    void    PutMask(int, int);
};


#endif // SEGMENTATION_H
